USE [TP_AI_Telefonia]
GO

/****** Object:  Table [dbo].[Lineas]    Script Date: 11/7/2012 9:45:15 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Lineas](
	[LineaId] [int] IDENTITY(1,1) NOT NULL,
	[UsuarioId] [int] NOT NULL,
	[NumeroId] [int] NOT NULL,
	[FechaContrato] [datetime] NOT NULL,
	[PlanId] [int] NOT NULL,
	[Estado] [nvarchar](50) NOT NULL,
	[Nombre] [varchar](200) NULL,
 CONSTRAINT [PK_Lineas] PRIMARY KEY CLUSTERED 
(
	[LineaId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[Lineas]  WITH CHECK ADD  CONSTRAINT [FK_Lineas_Numeros] FOREIGN KEY([NumeroId])
REFERENCES [dbo].[Numeros] ([NumeroId])
GO

ALTER TABLE [dbo].[Lineas] CHECK CONSTRAINT [FK_Lineas_Numeros]
GO

ALTER TABLE [dbo].[Lineas]  WITH CHECK ADD  CONSTRAINT [FK_Lineas_Planes] FOREIGN KEY([PlanId])
REFERENCES [dbo].[Planes] ([PlanId])
GO

ALTER TABLE [dbo].[Lineas] CHECK CONSTRAINT [FK_Lineas_Planes]
GO

ALTER TABLE [dbo].[Lineas]  WITH CHECK ADD  CONSTRAINT [FK_Lineas_Usuarios] FOREIGN KEY([UsuarioId])
REFERENCES [dbo].[Usuarios] ([UsuarioId])
GO

ALTER TABLE [dbo].[Lineas] CHECK CONSTRAINT [FK_Lineas_Usuarios]
GO

